package com.xiaoxi.statemode.state;

import com.xiaoxi.statemode.context.Context;

/**
 * @Author xiaoxi
 * @ProjectName design_mode
 * @PackageName com.xiaoxi.statemode.state
 * @ClassName DayState
 * @Description TODO
 * @Date 2023/3/27 21:30
 * @Version 1.0
 */
public class LunchState implements State {

    private String name;
    private static LunchState lunchState = new LunchState("午餐");

    private LunchState(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static LunchState getInstance() {
        return lunchState;
    }

    @Override
    public void doClock(Context context, int hour) {
        if (hour < 9 || hour >= 17) {
            context.changeState(NightState.getInstance());
        } else if (hour != 12) {
            context.changeState(DayState.getInstance());
        }
    }

    @Override
    public void doUse(Context context) {
        context.callSecurityCenter("紧急！午餐时间使用金库");
    }

    @Override
    public void doAlarm(Context context) {
        context.callSecurityCenter("紧急！按下警铃（午餐）");
    }

    @Override
    public void doPhone(Context context) {
        context.recordLog("留言一条呼叫(午餐)");
    }
}
